<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>招聘考试管理</title>
		<script src="js/global.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function(){
				init();
			})
			function init(){
				$('#tabProfes').datagrid({    
				    url:'http://127.0.0.1:8080/findProfes',    
				    method:"post",
				    pagination:true,
				    striped:true,
				    toolbar:"#tb",
			   });
			}
			function caozuo(value,row,index){
				return "<a href='javascript:void(0)' onclick='chuti("+index+")' class='easyui-linkbutton'>出题</a>"
			}
			function chuti(index){
				var data = $("#tabProfes").datagrid("getData");
				var row = data.rows[index]; 
				$("#updateForm").form("load", row); 
				$("#update_window").window("open");
				var table=document.getElementById("shijuan");
				$.post("http://127.0.0.1:8080/findBylFather",{
					lFather:0
				},function(res){
					for (var k=0;k<res.length;k++) {
						xunhuanyi(res,k,table);
						
					}
				},"json")
			}
			function xunhuanyi(res,k,table){
				$.post("http://127.0.0.1:8080/findBylFather",{
					lFather:res[k].lid
				},function(ress){
					
						//完整的行
						for (var i=-1;i<ress.length-1;i++) {
							var tr=document.createElement("tr");
								if(i<0){
									var tdr=document.createElement("td");
									tdr.rowSpan=++ress.length;
									tdr.innerText=res[k].lname;
									tr.appendChild(tdr)
									//循环第一行
									for (var j=0;j<3;j++) {
										var td=document.createElement("td");
										//第一行第一列
										if(j==0){
											td.colSpan=3;
											td.innerText="试题二级分类";
										}else if (j==1) {
											td.colSpan=2;
											td.innerText="可用试题数量";
										} else if (j==2){
											td.colSpan=2;
											td.innerText="出题数量";
										}
										tr.appendChild(td)
										
									}
								}else{
									//循环行
									
									for (var j=0;j<3;j++) {
										var td=document.createElement("td");
										if(j==0){
											td.colSpan=3;
											td.innerText=ress[i].lname;
										}else if (j==1) {
											td.innerText=fagfasss(ress[i].lid);	
											td.colSpan=2;
										} else if (j==2){
											td.colSpan=2;
											var txt=document.createElement("input");
											txt.type="text";
											txt.id="aaa"+k+i;
											td.appendChild(txt);
										}
										tr.appendChild(td)
									}
								}
							table.appendChild(tr)
						}
				},"json")		
			}
			function fagfasss(dwa){
				$.post("http://127.0.0.1:8080/findBykErcount",{
					kEr:dwa
				},function(resss){
					return resss;		
				},"json")
			}
			function baocun(){
				for (i=1,i<) {
					
				}
			}
		</script>
	</head>
	<body>
	<table id="tabProfes" class="easyui-datagrid" >
			<thead>
				<tr>
					<th data-options="field:'pparent',title:'职位分类编号'"></th>
					<th data-options="field:'pparent',title:'职位分类名称'"></th>
					<th data-options="field:'pid',title:'职位编号'"></th>
					<th data-options="field:'pname',title:'职位名称 '"></th>
					<th data-options="field:'pdate',title:'套题数量'"></th>
					<th data-options="field:'pdengji',title:'登记人',hidden:true">
					<th data-options="field:'pdjdate',title:'登记时间',hidden:true">
					<th data-options="field:'caozuo',title:'操作',align:'center',formatter:caozuo"></th>
				</tr>
			</thead>
		</table>
		<div id="update_window" class="easyui-window" title="增加新的机构" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:700px;height:400px;padding:10px;">
			<form id="updateForm">
			<table id="shijuan" border="1">
				<tr>
					<td>职位分类</td>
					<td><input id="pparent" style="width:80px;"  disabled="disabled"    name="pparent" value="--请选择--"></td>
					<td>职位名</td>
					<td><input id="pname" style="width:80px;"  disabled="disabled"   name="pname" value="--请选择--"></td>
					<td>登记人</td>
					<td><input id="pdengji"  name="pdengji" style="width:80px;" disabled="disabled"   > </td>
					<td>登记时间</td>
					<td><input  id="pdjdate" name="pdjdate" type= "text" disabled="disabled" style="width:80px;"></td>
				</tr>
				<tr>
					<td>答题时间(分钟)</td>
					<td colspan="7"><input  type="text"  id="ktiganadd" style="width:560px;"></td>
				</tr>
				
				
				
					<a href="javascript:void(0)" class="easyui-linkbutton" type="button" onclick="addbaocun()">保存</a>
					<a href="javascript:void(0)" class="easyui-linkbutton" onclick="addjigouquxiao()">取消</a>
			
			</table>
			</form>
		</div>	
	</body>
</html>
